package com.fs.ibox_h.servie.impl;

import com.fs.ibox_h.dao.CollectionDao;
import com.fs.ibox_h.dao.IdCollectionDao;
import com.fs.ibox_h.pojo.Collection;
import com.fs.ibox_h.pojo.IdCollection;
import com.fs.ibox_h.servie.IdCollectionService;
import com.fs.ibox_h.util.BeanFactory;
import com.fs.ibox_h.vo.IdCollectionCondition;
import com.fs.ibox_h.vo.Page;
import com.fs.ibox_h.vo.Position;
import com.fs.ibox_h.vo.StatsCname;

import java.util.List;

/**
 * Author:HOU
 * date:2022/11/19  18:31
 * 案例:
 **/
public class IdCollectionServiceImpl implements IdCollectionService {
    IdCollectionDao idcollectionDao = BeanFactory.createBean(IdCollectionDao.class);

    @Override
    public List<Position> selectByCname(String cname) {

        return idcollectionDao.selectByCname(cname);
    }

    @Override
    public List<IdCollection> selectAll() {
        return idcollectionDao.selectAll();
    }

    @Override
    public Page<IdCollection> selceByIdCondition(int currentPageInt, int pageSizeInt, IdCollectionCondition idCollectionCondition) {
        Page<IdCollection> page = new Page<>(currentPageInt,pageSizeInt);
        page.setCount(idcollectionDao.count(idCollectionCondition));
        page.setRecords(idcollectionDao.selectByCnameStateId(currentPageInt,pageSizeInt,idCollectionCondition));
        return page;
    }

    @Override
    public List<StatsCname> selectAllCnaem() {
        return idcollectionDao.selectAllCnaem();
    }
}
